package com.acegear.horizon.domain.repository.jpa;

import com.acegear.horizon.domain.models.jpa.ClubEventMember;

import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;
import java.util.Optional;

/**
 * Created by mercury on 2016/12/22.
 */
public interface ClubEventMemberRepository extends PagingAndSortingRepository<ClubEventMember, Long> {

    List<ClubEventMember> findByEventId(Long eventId);

    List<ClubEventMember> findByUserIdOrderByEventIdDesc(Long userId, Pageable pageable);

    Integer countByEventId(Long eventId);

    Integer countByUserId(Long userId);

    Optional<ClubEventMember> findByEventIdAndUserId(Long eventId, Long userId);
}
